<!DOCTYPE html>
<html>
	<head>
		<title>列表页第二版</title>
		<!-- bootstrap-table样式 -->
		<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/bootstrap-table/bootstrap-table.min.css" />

		<link rel="stylesheet" type="text/css" href="../css/list/form/formList.css" />
		<link rel="stylesheet" type="text/css" href="../css/list/form/formDetail.css" />
		<link rel="stylesheet" type="text/css" href="../css/list/form/formSupervision.css" />
		<!-- 自定义css -->
		<link rel="stylesheet" type="text/css" href="../css/list/list.css" />
	</head>
	<body>

		<div id="case_datas" class="formContent">
			<div id="title">
				<span>列表</span>
				<span>总记录数：<strong id="totalCount" class='totalCount'>0</strong>条</span>(共<span id="totalPage" class='totalPage'
				 style="margin-right:0;">1</span>页)
				<span id="newbutton"><input type="button" id="new" class="dengji" value="添加 " onclick="register()" />
				</span>

			</div>
			<div class="statisContent">
				<div>
					<table width="100%" cellspacing="0" cellpadding="0" border="0" style="margin-top: 10px;" class="table-frm">
						<tbody>
							<tr>
								<td>标题：</td>
								<td>
									<input type="text" id="company_name" value="" />
								</td>
								<td>
									<input type="reset" class="searchDep" value="查询" onclick="queryRegisterCase()" />
								</td>
							</tr>
						</tbody>
					</table>
				</div>
			</div>

			<div id="maingrid">
				<table class="gridView" id="bootstrap-table" data-mobile-responsive="true">
					<thead>
						<tr>
							<th data-field="state" data-checkbox="true"></th>
							<th data-field="id" data-sort-stable="true">ID</th>
							<th data-field="name">名称</th>
							<th data-field="price">ddd</th>
							<th data-field="price">价格</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
							<td>aaa11</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>1</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>
						<tr>
							<td>
								<input type="checkbox"></td>
							<td>1</td>
							<td>测试0</td>
							<td>111</td>
						</tr>

					</tbody>
				</table>
			</div>
			<!--Grid结束-->
			<div id="permission" style="display: none">
				<shiro:hasPermission name="system:user:look">
					<a class="btn btn-success btn-xs " href="javascript:void(0)" id="look"><i class="fa fa-edit"></i>查看</a>
				</shiro:hasPermission>
				<shiro:hasPermission name="system:user:editor">
					<a class="btn btn-primary btn-xs " href="javascript:void(0)" id="editor"><i class="fa fa-check-square-o"></i>编辑</a>
				</shiro:hasPermission>
				<shiro:hasPermission name="system:user:del"><a class="btn btn-danger btn-xs " href="javascript:void(0)" id="del">
						<i class="fa fa-remove"></i>删除</a> </shiro:hasPermission>
				<shiro:hasPermission name="system:user:revocation">
					<a class="btn btn-warning btn-xs " href="javascript:void(0)" id="revocation"><i class="fa fa-remove"></i>撤销</a>
				</shiro:hasPermission>
			</div>
		</div>
		<!-- jquery -->
		<script src="../js/jquery.min.js" type="application/javascript"></script>
		<!-- Bootstrap table -->
		<script src="../js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/bootstrap-table/bootstrap-table.min.js"></script>
		<script src="../js/bootstrap-table/bootstrap-table-mobile.min.js"></script>
		<script src="../js/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>

		<script type="application/javascript">
			// 获取条件值
			function queryParams(params) {
				// 将json对象转为json字符串
				// var paramStr=JSON.stringify(params);
				// alert(paramStr);
				var temp = { //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
					pageSize: params.pageSize, //页面大小
					pageNum: params.pageNumber, //页码
					condition1: $("#condition1").val(),
					// condition2: $("#condition2").val(),
				};
				return temp;
			}

			//搜索
			function query() {
				$('#bootstrap-table').bootstrapTable('refresh', queryParams);
			}

			$('#bootstrap-table').bootstrapTable({
				url: "list.josn", // 请求路径
				queryParamsType: '', //默认值为 'limit' ,在默认情况下传给服务端的参数为：offset,limit,sort, 设置为 ''
				// 在这种情况下传给服务器的参数为：pageSize,pageNumber
				method: 'get', //请求方式（*）
				//toolbar: '#toolbar',                //工具按钮用哪个容器
				striped: true, //是否显示行间隔色
				cache: false, //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
				pagination: true, //是否显示分页（*）
				sortable: false, //是否启用排序
				sortOrder: "asc", //排序方式
				queryParams: queryParams, //传递参数（*）
				sidePagination: "server", //分页方式：client客户端分页，server服务端分页（*）
				pageNumber: 1, //初始化加载第一页，默认第一页
				// search: true,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
				strictSearch: true,
				showColumns: false, //是否显示所有的列
				showRefresh: true, //是否显示刷新按钮
				minimumCountColumns: 3, //最少允许的列数
				clickToSelect: true, //是否启用点击选中行
				// height: 500,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
				uniqueId: "id", //每一行的唯一标识，一般为主键列
				showToggle: false, //是否显示详细视图和列表视图的切换按钮
				cardView: false, //是否显示详细视图
				detailView: false, //是否显示父子表
				columns: [{
						checkbox: true
					},
					{
						title: '序号',
						align: 'center',
						halign: 'center',
						formatter: function(value, row, index) {
							var options = $('#bootstrap-table').bootstrapTable('getOptions');
							return options.pageSize * (options.pageNumber - 1) + index + 1;
						}
					}, {
						field: 'uid',
						visible: false
					}, {
						title: '标题',
						field: 'title',
						sortable: true
					}, {
						title: '发布人',
						field: 'issuer',
					}, {
						title: '发布时间',
						field: 'releaseTime',
					}, {
						title: '是否发布',
						align: 'center',
						formatter: function(value, row, index) {
							if (row.isReleased == 0) {
								return "<i class='fa fa-toggle-off text-info fa-2x' id='state'></i> ";
							} else {
								return "<i class='fa fa-toggle-on text-info fa-2x' id='state'></i> ";
							}
						}
					}, {
						title: '操作',
						align: 'center',
						formatter: function(value, row, index) {
							// var actions = "";
							// actions='<shiro:hasPermission name="system:user:look"><a class="btn btn-success btn-xs " href="javascript:void(0)" id="look"  ><i class="fa fa-edit"></i>查看</a> </shiro:hasPermission>';
							// actions=actions+'<shiro:hasPermission name="system:user:editor"><a class="btn btn-primary btn-xs " href="javascript:void(0)" id="editor" ><i class="fa fa-check-square-o"></i>编辑</a> </shiro:hasPermission>';
							// actions=actions+'<shiro:hasPermission name="system:user:del"><a class="btn btn-danger btn-xs " href="javascript:void(0)" id="del"  ><i class="fa fa-remove"></i>删除</a> </shiro:hasPermission>';
							// actions=actions+'<shiro:hasPermission name="system:user:revocation">\n<a class="btn btn-warning btn-xs " href="javascript:void(0)" id="revocation"  ><i class="fa fa-remove"></i>撤销</a></shiro:hasPermission>';
							// return actions;
							return getOperateBtns();

						}
					}
				]
			});
			//定义一个获取按钮的方法
			function getOperateBtns() {
				var html = "";
				$("#permission").find("a").each(function() {
					html += this.outerHTML + " ";
				});
				if (html == "" || html == null) {
					return "无权限";
				}
				return html;
			}
		</script>
	</body>
</html>
